#ifndef NEOCALENDARMASK_H
#define NEOCALENDARMASK_H

#include "stdafx.h"
#include <QWidget>

class QParallelAnimationGroup;
class QPropertyAnimation;
class NeoCalendarMask : public QWidget
{
    Q_OBJECT
    NEO_PROPERTY_CREATE(qreal, ViewOpacity)
    NEO_PROPERTY_CREATE(qreal, ZoomRatio)
public:
    NeoCalendarMask(QWidget *parent = nullptr, bool isAnimationFinishedHide = true);
    ~NeoCalendarMask();

    void setStartPixmap(const QPixmap &pixmap);
    void setEndPixmap(const QPixmap &pixmap);
    void startAnimation(bool isZoomIn);
    void setAnimationFinishedCallback(const QFunction<void()> &callback);

protected:
    void paintEvent(QPaintEvent *event) override;

private:
    bool mIsZoomIn;
    QPixmap mStartPixmap;
    QPixmap mEndPixmap;
    QPropertyAnimation *mOpacityAnimation;
    QPropertyAnimation *mZoomAnimation;
    QParallelAnimationGroup *mParallelAnimationGroup;
    QFunction<void()> mAnimationFinishedCallback;
};

#endif